Skip to content

Commit

Permalink
docs: print patch version
Browse files Browse the repository at this point in the history
  • Loading branch information
hunjixin committed Aug 9, 2022
1 parent 47f4f8e commit 85217c0
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 1 deletion.
14 changes: 14 additions & 0 deletions 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
docs: print patch version

# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# Date: Tue Aug 9 10:22:49 2022 +0800
#
# On branch feat/add_patch_command
# Your branch is up to date with 'origin/feat/add_patch_command'.
#
# Changes to be committed:
# modified: tools/sdk_tool/src/patch.rs
# modified: tools/sdk_tool/src/utils.rs
#
2 changes: 2 additions & 0 deletions tools/sdk_tool/src/patch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ pub struct PatchConfig {}
pub fn apply_patch(_: &PatchConfig) -> Result<()> {
utils::check_tinygo_install()?;
utils::check_go_install()?;
let patch_version = utils::get_patch_version()?;
println!("patch version {}", patch_version);
let envs = utils::get_tinygo_env()?;
println!("{:?}", envs);

Expand Down
13 changes: 13 additions & 0 deletions tools/sdk_tool/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,19 @@ pub fn get_tinygo_version() -> Result<String> {
}
}

pub fn get_patch_version() -> Result<String> {
match Command::new("patch").arg("-version").output() {
Ok(output) => Ok(String::from_utf8(output.stdout)?),
Err(e) => {
if let ErrorKind::NotFound = e.kind() {
Err(anyhow!("unable to found patch tool"))
} else {
Err(anyhow!("fail exec patch -version {}", e))
}
}
}
}

pub fn check_fvm_tool_install() -> Result<()> {
match Command::new("go-fvm-sdk-tools")
.stdout(Stdio::null())
Expand Down
2 changes: 1 addition & 1 deletion tools/sdk_tool/src/wasmprocess.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ impl<'a> GoFvmBinProcessor<'a> {
.args([
"build",
"-target",
"fvm",
"wasi",
"-no-debug",
"-panic",
"trap",
Expand Down

0 comments on commit 85217c0

Please sign in to comment.