Skip to content

Commit 8813c2a

Browse files
authored
Add trace log to open_url (#21)
1 parent cd1b8a1 commit 8813c2a

File tree

1 file changed

+18
-15
lines changed

1 file changed

+18
-15
lines changed

crates/fig_util/src/open.rs

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,15 @@ pub fn open_url(url: impl AsRef<str>) -> Result<(), Error> {
6161
if #[cfg(target_os = "macos")] {
6262
open_macos(url)
6363
} else {
64-
match open_command(url)
65-
.stdout(std::process::Stdio::null())
66-
.stderr(std::process::Stdio::null())
67-
.status()
68-
{
69-
Ok(status) if status.success() => Ok(()),
70-
Ok(_) => Err(Error::Failed),
64+
match open_command(url).output() {
65+
Ok(output) => {
66+
tracing::trace!(?output, "open_url output");
67+
if output.status.success() {
68+
Ok(())
69+
} else {
70+
Err(Error::Failed)
71+
}
72+
},
7173
Err(err) => Err(err.into()),
7274
}
7375
}
@@ -80,14 +82,15 @@ pub async fn open_url_async(url: impl AsRef<str>) -> Result<(), Error> {
8082
if #[cfg(target_os = "macos")] {
8183
open_macos(url)
8284
} else {
83-
match tokio::process::Command::from(open_command(url))
84-
.stdout(std::process::Stdio::null())
85-
.stderr(std::process::Stdio::null())
86-
.status()
87-
.await
88-
{
89-
Ok(status) if status.success() => Ok(()),
90-
Ok(_) => Err(Error::Failed),
85+
match tokio::process::Command::from(open_command(url)).output().await {
86+
Ok(output) => {
87+
tracing::trace!(?output, "open_url_async output");
88+
if output.status.success() {
89+
Ok(())
90+
} else {
91+
Err(Error::Failed)
92+
}
93+
},
9194
Err(err) => Err(err.into()),
9295
}
9396
}

0 commit comments

Comments
 (0)