[Microsoft.Build] Ignore ThreadAbortException in BuildNodeManager
[mono-project.git] / mono / tests / setenv.cs
blobbd0d86eb0e4873fea7ab1c5a5d17b134122c8f3c
1 using System;
2 using System.Runtime.InteropServices;
4 namespace Test {
6 public class Test {
7 [DllImport("libc")]
8 static extern int setenv(string name, string value, int overwrite);
9 [DllImport("libc")]
10 static extern IntPtr getenv(string name);
12 static int Main() {
13 try {
14 string name = "mono_test";
15 string value = "val";
17 setenv (name, value, 1);
18 string ret = Marshal.PtrToStringAnsi (getenv (name));
20 if (ret != value)
21 return 1;
23 catch (EntryPointNotFoundException) {
24 /* setenv is not available on some platforms */
26 catch (DllNotFoundException) {
27 /* libc might not be accessible by that name */
30 return 0;