Skip to content
Merged
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 Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions stdlib/Cargo.toml
Original file line numberDiff line numberDiff line change
Expand Up@@ -36,3 +36,4 @@ uuid = { version = "1", features = ["v4"] }
rustls = { version = "0.23", optional = true }
tokio = { version = "1", features = ["rt", "macros", "sync", "time"], optional = true }
hex = "0.4.3"
shlex = "2.0.1"
21 changes: 19 additions & 2 deletions stdlib/src/process.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -114,8 +114,25 @@ impl StdlibRegistry {
))
}
};
Command::new("cmd")
.args(["/C", &cmd])

let parsed = shlex::split(&cmd).ok_or_else(|| {
RuntimeError::new(
RuntimeErrorKind::InvalidOperation("Failed to parse command string".to_string()),
None,
None,
)
})?;

if parsed.is_empty() {
return Err(RuntimeError::new(
RuntimeErrorKind::InvalidOperation("Empty command string".to_string()),
None,
None,
));
}

Command::new(&parsed[0])
.args(&parsed[1..])
.spawn()
.map_err(|e| {
RuntimeError::new(
Expand Down
2 changes: 1 addition & 1 deletion stdlib/tests/stdlib_tests.rs
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
use std::cell::RefCell;
use std::collections::HashSet;
use std::rc::Rc;
use techscript_runtime::{context::Capability, value::RuntimeValue, RuntimeConfig, RuntimeContext};
use techscript_runtime::{context::Capability, value::RuntimeValue, RuntimeConfig, RuntimeContext, error::RuntimeErrorKind};
use techscript_stdlib::StdlibRegistry;

#[test]
Expand Down
Loading