@@ -3,7 +3,7 @@ import { Child, Command } from '@tauri-apps/plugin-shell';
33import { Button } from 'antd' ;
44import TextArea from 'antd/es/input/TextArea' ;
55import path from 'path' ;
6- import { BaseDirectory , Dir , writeTextFile } from '@tauri-apps/plugin-fs' ;
6+ import { BaseDirectory , writeTextFile } from '@tauri-apps/plugin-fs' ;
77import { join , appDataDir , homeDir } from '@tauri-apps/api/path' ;
88import Editor from '@monaco-editor/react' ;
99
@@ -26,7 +26,7 @@ const TauriShell = () => {
2626 const runCommand = async ( ) => {
2727 setStdOut ( '' ) ;
2828 setStatus ( ProcessStatus . RUNNING ) ;
29- const command = new Command ( 'python' , [ pythonDir . current ] ) ;
29+ const command = Command . create ( 'python' , [ pythonDir . current ] ) ;
3030 command . on ( 'close' , ( data ) => {
3131 console . log ( `command finished with code ${ data . code } and signal ${ data . signal } ` ) ;
3232 setStatus ( data . code === 0 ? ProcessStatus . SUCCESS : ProcessStatus . ERROR ) ;
@@ -42,7 +42,7 @@ const TauriShell = () => {
4242 } ) ;
4343
4444 child . current = await command . spawn ( ) ;
45- console . log ( 'pid:' , child . current . pid ) ;
45+ console . log ( 'pid:' , child . current ? .pid ) ;
4646 } ;
4747
4848 const kill = async ( ) => {
@@ -65,8 +65,9 @@ const TauriShell = () => {
6565 const _homeDir = await homeDir ( ) ;
6666 pythonDir . current = await join ( _homeDir , '.pntools' , 'python' , 'python.py' ) ;
6767 await writeTextFile (
68- { contents : code , path : await join ( _homeDir , '.pntools' , 'python' , 'python.py' ) } ,
69- { dir : BaseDirectory . Home } ,
68+ await join ( _homeDir , '.pntools' , 'python' , 'python.py' ) ,
69+ code ,
70+ { baseDir : BaseDirectory . Home } ,
7071 ) ;
7172 } ) ( ) ;
7273 } , [ code ] ) ;
0 commit comments