Handle command errors

This commit is contained in:
Nicola Spadari
2024-10-08 12:31:40 +02:00
parent 0768f66e5e
commit 84626cfbbd

View File

@@ -34,13 +34,17 @@
const result = ref(""); const result = ref("");
const sendCommand = async () => { const sendCommand = async () => {
try{
const response = await useTauriShellCommand.create("exec-sh", [ const response = await useTauriShellCommand.create("exec-sh", [
"-c", "-c",
input.value input.value
]).execute(); ]).execute();
result.value = JSON.stringify(response, null, 4); result.value = JSON.stringify(response, null, 4);
}catch(error){
result.value = JSON.stringify(error, null, 4);
}finally{
input.value = ""; input.value = "";
}
}; };
</script> </script>