Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix c++ spawn failure by handling empty string properly #4349

Merged
merged 1 commit into from
Nov 28, 2023
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
10 changes: 7 additions & 3 deletions crates/rerun_c/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ impl CStringView {
pub fn is_null(&self) -> bool {
self.string.is_null()
}

pub fn is_empty(&self) -> bool {
self.length == 0
}
}

pub type CRecordingStream = u32;
Expand Down Expand Up @@ -71,15 +75,15 @@ impl CSpawnOptions {
spawn_opts.port = self.port;
}

if !self.memory_limit.is_null() {
if !self.memory_limit.is_empty() {
spawn_opts.memory_limit = self.memory_limit.as_str("memory_limit")?.to_owned();
}

if !self.executable_name.is_null() {
if !self.executable_name.is_empty() {
spawn_opts.executable_name = self.executable_name.as_str("executable_name")?.to_owned();
}

if !self.executable_path.is_null() {
if !self.executable_path.is_empty() {
spawn_opts.executable_path =
Some(self.executable_path.as_str("executable_path")?.to_owned());
}
Expand Down
6 changes: 4 additions & 2 deletions rerun_cpp/src/rerun/spawn_options.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,19 @@ namespace rerun {
/// When this limit is reached, Rerun will drop the oldest data.
/// Example: `16GB` or `50%` (of system total).
///
/// Defaults to `75%` if null.
/// Defaults to `75%` if unset.
std::string_view memory_limit = "75%";

/// Specifies the name of the Rerun executable.
///
/// You can omit the `.exe` suffix on Windows.
///
/// Defaults to `rerun` if unset.
std::string_view executable_name = "rerun";

/// Enforce a specific executable to use instead of searching though PATH
/// for `SpawnOptions::executable_name`.
std::string_view executable_path = "";
std::string_view executable_path;

/// Convert to the corresponding rerun_c struct for internal use.
///
Expand Down
Loading