diff --git a/src/bro.bif b/src/bro.bif index 6a79a1ac9d..0b880de379 100644 --- a/src/bro.bif +++ b/src/bro.bif @@ -466,17 +466,18 @@ function system%(str: string%): int ## ## str: The command to execute. ## -## env: A :bro:type:`set` or :bro:type:`table` with the environment variables -## in the form of key-value pairs (where the value is optional). +## env: A :bro:type:`table` with the environment variables in the form +## of key-value pairs. Each specified environment variable name +## will be automatically prepended with ``BRO_ARG_``. ## ## Returns: The return value from the OS ``system`` function. ## ## .. bro:see:: system str_shell_escape piped_exec -function system_env%(str: string, env: any%): int +function system_env%(str: string, env: table_string_of_string%): int %{ if ( env->Type()->Tag() != TYPE_TABLE ) { - builtin_error("system_env() requires a table/set argument"); + builtin_error("system_env() requires a table argument"); return new Val(-1, TYPE_INT); } diff --git a/testing/btest/Baseline/bifs.system_env/testfile b/testing/btest/Baseline/bifs.system_env/testfile index 8b13789179..31e0fce560 100644 --- a/testing/btest/Baseline/bifs.system_env/testfile +++ b/testing/btest/Baseline/bifs.system_env/testfile @@ -1 +1 @@ - +helloworld diff --git a/testing/btest/bifs/system_env.bro b/testing/btest/bifs/system_env.bro index 26e40b883f..23928e9b10 100644 --- a/testing/btest/bifs/system_env.bro +++ b/testing/btest/bifs/system_env.bro @@ -7,17 +7,17 @@ event bro_init() local vars: table[string] of string = { ["TESTBRO"] = "helloworld" }; # make sure the env. variable is not set - local myvar = getenv("TESTBRO"); + local myvar = getenv("BRO_ARG_TESTBRO"); if ( |myvar| != 0 ) exit(1); # check if command runs with the env. variable defined - local a = system_env("echo $TESTBRO > testfile", vars); + local a = system_env("echo $BRO_ARG_TESTBRO > testfile", vars); if ( a != 0 ) exit(1); # make sure the env. variable is still not set - myvar = getenv("TESTBRO"); + myvar = getenv("BRO_ARG_TESTBRO"); if ( |myvar| != 0 ) exit(1); }