File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -1523,7 +1523,7 @@ elif not defined(useNimRtl):
15231523 header : " <stdlib.h>" .}
15241524
15251525 proc execCmd (command: string ): int =
1526- when defined (linux ):
1526+ when defined (posix ):
15271527 let tmp = csystem (command)
15281528 result = if tmp == - 1 : tmp else : exitStatusLikeShell (tmp)
15291529 else :
Original file line number Diff line number Diff line change @@ -29,6 +29,12 @@ when defined(case_testfile): # compiled test file for child process
2929 case arg
3030 of " exit_0" :
3131 if true : quit (0 )
32+ of " exit_1" :
33+ if true : quit (1 )
34+ of " exit_2" :
35+ if true : quit (2 )
36+ of " exit_42" :
37+ if true : quit (42 )
3238 of " exitnow_139" :
3339 if true : exitnow (139 )
3440 of " c_exit2_139" :
@@ -115,6 +121,13 @@ else: # main driver
115121 runTest (" c_exit2_139" , 139 )
116122 runTest (" quit_139" , 139 )
117123
124+ block execCmdTest:
125+ let output = compileNimProg (" -d:release -d:case_testfile" , " D20220705T221100" )
126+ doAssert execCmd (output & " exit_0" ) == 0
127+ doAssert execCmd (output & " exit_1" ) == 1
128+ doAssert execCmd (output & " exit_2" ) == 2
129+ doAssert execCmd (output & " exit_42" ) == 42
130+
118131 import std/ streams
119132
120133 block execProcessTest:
You can’t perform that action at this time.
0 commit comments