Skip to content

Commit e907db1

Browse files
cornelkaykevl
authored andcommitted
os: add Args and stub it with mock data
1 parent 6b89404 commit e907db1

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/os/proc.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,15 @@ import (
99
"syscall"
1010
)
1111

12+
// Args hold the command-line arguments, starting with the program name.
13+
var Args []string
14+
15+
func init() {
16+
Args = runtime_args()
17+
}
18+
19+
func runtime_args() []string // in package runtime
20+
1221
// Exit causes the current program to exit with the given status code.
1322
// Conventionally, code zero indicates success, non-zero an error.
1423
// The program terminates immediately; deferred functions are not run.

src/runtime/runtime.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,12 @@ func GOROOT() string {
2424
return "/usr/local/go"
2525
}
2626

27+
// TODO: fill with real args.
28+
var args = []string{"/proc/self/exe"}
29+
2730
//go:linkname os_runtime_args os.runtime_args
2831
func os_runtime_args() []string {
29-
return nil
32+
return args
3033
}
3134

3235
// Copy size bytes from src to dst. The memory areas must not overlap.

0 commit comments

Comments
 (0)