Delta Between Two Patch Sets: src/lib9/run_plan9.c
Issue 7523043 :
code review 7523043: lib9: add mktempdir, removeall, runprog (Closed)
Left Patch Set:
Right Patch Set: diff -r d8a691500f6f https://code.google.com/p/go/
Use n/p to move between diff chunks;
N/P to move between comments.
Please Sign in to add in-line comments.
Jump to:
include/libc.h
src/cmd/dist/windows.c
src/lib9/run_plan9.c
src/lib9/run_unix.c
src/lib9/run_windows.c
src/lib9/tempdir_plan9.c
src/lib9/tempdir_unix.c
src/lib9/tempdir_windows.c
src/lib9/win.h
LEFT RIGHT
(no file at all) 1 // Copyright 2013 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 #include <u.h>
6 #include <libc.h>
7
8 int
9 runcmd(char **argv)
10 {
11 int pid;
12 Waitmsg *w;
13 · · · · · · · ·
14 switch(pid = fork()) {
15 case -1:
16 return -1;
17 case 0:
18 execvp(argv[0], argv);
19 fprint(2, "exec %s: %r", argv[0]);
20 _exit(1);
21 }
22 · · · · · · · ·
23 w = wait();
24 if(w == nil)
25 return -1;
26 if(w->pid != pid) {
27 werrstr("unexpected pid in wait");
28 free(w);
29 return -1;
30 }
31 if(w->msg[0]) {
32 werrstr("unsuccessful exit status: %s", w->msg);
33 free(w);
34 return -1;
35 }
36 free(w);
37 return 0;
38 }
LEFT RIGHT