@@ -71,7 +71,7 @@ func (s Sync) syncPaths(delete bool, local, remote string) error {
71
71
return nil
72
72
}
73
73
74
- func (s Sync ) remoteRm (ctx context.Context , remote string ) error {
74
+ func (s Sync ) remoteCmd (ctx context.Context , prog string , args ... string ) error {
75
75
conn , err := s .Client .DialWsep (ctx , s .Env )
76
76
if err != nil {
77
77
return err
@@ -80,8 +80,8 @@ func (s Sync) remoteRm(ctx context.Context, remote string) error {
80
80
81
81
execer := wsep .RemoteExecer (conn )
82
82
process , err := execer .Start (ctx , wsep.Command {
83
- Command : "rm" ,
84
- Args : [] string { "-rf" , remote } ,
83
+ Command : prog ,
84
+ Args : args ,
85
85
})
86
86
if err != nil {
87
87
return err
@@ -91,7 +91,7 @@ func (s Sync) remoteRm(ctx context.Context, remote string) error {
91
91
92
92
err = process .Wait ()
93
93
if code , ok := err .(wsep.ExitError ); ok {
94
- return fmt .Errorf ("rm exit status: %v" , code )
94
+ return fmt .Errorf ("%s exit status: %v" , prog , code )
95
95
}
96
96
if err != nil {
97
97
return xerrors .Errorf ("execution failure: %w" , err )
@@ -144,7 +144,7 @@ func (s Sync) handleDelete(localPath string) error {
144
144
ctx , cancel := context .WithTimeout (context .Background (), time .Minute )
145
145
defer cancel ()
146
146
147
- return s .remoteRm (ctx , s .convertPath (localPath ))
147
+ return s .remoteCmd (ctx , "rm" , "-rf" , s .convertPath (localPath ))
148
148
}
149
149
150
150
func (s Sync ) handleRename (localPath string ) error {
@@ -260,6 +260,11 @@ func (s Sync) Run() error {
260
260
}
261
261
defer notify .Stop (events )
262
262
263
+ ctx , cancel := context .WithTimeout (context .Background (), time .Minute )
264
+ defer cancel ()
265
+
266
+ s .remoteCmd (ctx , "mkdir" , "-p" , s .RemoteDir )
267
+
263
268
ap := activity .NewPusher (s .Client , s .Env .ID , activityName )
264
269
ap .Push ()
265
270
0 commit comments