Fun 0.41.5
The programming language that makes You have fun
Loading...
Searching...
No Matches
proc_system.c File Reference

Implements OP_PROC_SYSTEM to execute a shell command and return exit code. More...

Go to the source code of this file.

Functions

 free_value (cmdv)
 if (!cmd)
 push_value (vm, make_int(code))
 free (cmd)

Variables

case OP_PROC_SYSTEM
char * cmd = value_to_string_alloc(&cmdv)
int status = system(cmd)
int code = -1
 break

Detailed Description

Implements OP_PROC_SYSTEM to execute a shell command and return exit code.

Behavior:

  • Pops command (string); executes it using system(3); pushes the process exit code (int) or -1 on failure.

Errors:

  • If command is not a string or cannot be executed, returns -1.

Definition in file proc_system.c.

Function Documentation

◆ free()

free(cmd)

◆ free_value()

free_value(cmdv)

◆ if()

if(!cmd)

Definition at line 26 of file proc_system.c.

Here is the call graph for this function:

◆ push_value()

push_value(vm,
make_int(code) )
Here is the caller graph for this function:

Variable Documentation

◆ break

break

Definition at line 44 of file proc_system.c.

◆ cmd

char* cmd = value_to_string_alloc(&cmdv)

Definition at line 24 of file proc_system.c.

◆ code

code = -1

Definition at line 31 of file proc_system.c.

◆ OP_PROC_SYSTEM

case OP_PROC_SYSTEM

Definition at line 21 of file proc_system.c.

◆ status

int status = system(cmd)

Definition at line 30 of file proc_system.c.