Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions dag/extdeps/exec/command.dag
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ fn argv_command(program: ProgramIdentity, arguments: List<String>) -> ArgvComman
decl_ref(module_path: "extdeps.tools.ldd", decl_name: "ldd_command"),
decl_ref(module_path: "extdeps.tools.dpkg_deb", decl_name: "dpkg_deb_extract_command"),
decl_ref(module_path: "extdeps.tools.node", decl_name: "node_eval_command"),
decl_ref(module_path: "extdeps.tools.node", decl_name: "node_run_file_command"),
decl_ref(module_path: "extdeps.tools.node", decl_name: "node_version_command"),
decl_ref(module_path: "extdeps.browser.chromium", decl_name: "chromium_version_command"),
decl_ref(module_path: "extdeps.tools.squashfs_tools", decl_name: "unsquashfs_extract_command"),
Expand Down
1 change: 1 addition & 0 deletions dag/extdeps/exec/program.dag
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ fn cataloged_program(invocation: NonEmptyStr) -> ProgramIdentity
decl_ref(module_path: "extdeps.tools.busybox", decl_name: "busybox_dd_sparse_image_command"),
decl_ref(module_path: "extdeps.tools.unzip", decl_name: "unzip_program"),
decl_ref(module_path: "extdeps.tools.node", decl_name: "node_version_command"),
decl_ref(module_path: "extdeps.tools.node", decl_name: "node_run_file_command"),
decl_ref(module_path: "extdeps.tools.node", decl_name: "node_eval_command"),
decl_ref(module_path: "extdeps.tools.xorriso", decl_name: "xorriso_program"),
decl_ref(module_path: "extdeps.nftables.ruleset", decl_name: "nft_program"),
Expand Down
5 changes: 5 additions & 0 deletions dag/extdeps/tools/node.dag
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,8 @@ fn node_version_command(node_binary: NonEmptyStr) -> ArgvCommand {
fn node_eval_command(node_binary: NonEmptyStr, script: String, operands: List<String>) -> ArgvCommand {
argv_command(program: cataloged_program(invocation: node_binary), arguments: concat(["-e", script], operands))
}

// `node <script> <args...>`: runs a Node script file with arguments.
fn node_run_file_command(node_binary: NonEmptyStr, script_path: NonEmptyStr, operands: List<String> = []) -> ArgvCommand {
argv_command(program: cataloged_program(invocation: node_binary), arguments: concat([script_path], operands))
}
26 changes: 18 additions & 8 deletions dag/gunbc/instruments/emit_host_transport.dag
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,13 @@ import tools.emit_host_fixtures {
ts_signed_i32_le_byte_count
}
import gunbc.node_http_server_emit { gunbhub_node_http_server_source }
import v2.std.orchestration { EnvSet }
import extdeps.posix.process
import extdeps.posix.signal
import extdeps.http.client
import extdeps.tools.sleep
import extdeps.exec.command { env_prefixed_command_in }
import extdeps.tools.node { node_run_file_command, node_program }
import extdeps.numeric.base16
import std.content_hash { content_hash_atom }
import v2.std.collection { list_at_optional }
Expand Down Expand Up @@ -271,15 +274,22 @@ fn run_node_http_serve_smoke() -> Bool {
Absent => false
Present { value: port } => {
let server_js = Filesystem.Write(path: concat(dir.path, "/server.js"), content: gunbhub_node_http_server_source())
let spawn = posix.Process.StartDetached(
program: "env" as NonEmptyStr,
arguments: [
"-C", dir.path,
"HOST=127.0.0.1",
concat("PORT=", to_string(port)),
"node",
concat(dir.path, "/server.js")
let inner_cmd = node_run_file_command(
node_binary: node_program().invocation,
script_path: concat(dir.path, "/server.js") as NonEmptyStr,
operands: []
)
let prefixed_cmd = env_prefixed_command_in(
directory: dir.path,
bindings: [
EnvSet { name: "HOST", value: "127.0.0.1" },
EnvSet { name: "PORT", value: to_string(port) }
],
command: inner_cmd
)
let spawn = posix.Process.StartDetached(
program: prefixed_cmd.program.invocation,
arguments: prefixed_cmd.arguments,
stdout_file: concat(dir.path, "/server.stdout.log") as NonEmptyStr,
stderr_file: concat(dir.path, "/server.stderr.log") as NonEmptyStr
)
Expand Down
Loading