Skip to content

Commit 8ba85a5

Browse files
committed
Delete screen recording after serving.
1 parent 9557070 commit 8ba85a5

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

lib/commands/record-screen.js

+16-11
Original file line numberDiff line numberDiff line change
@@ -321,18 +321,23 @@ export async function stopRecordingScreen (
321321
this.log.debug('No video data is found. Returning an empty string');
322322
return '';
323323
}
324-
if (_.isEmpty(remotePath)) {
325-
const {size} = await fs.stat(videoPath);
326-
this.log.debug(`The size of the resulting screen recording is ${util.toReadableSizeString(size)}`);
324+
325+
try {
326+
if (_.isEmpty(remotePath)) {
327+
const {size} = await fs.stat(videoPath);
328+
this.log.debug(`The size of the resulting screen recording is ${util.toReadableSizeString(size)}`);
329+
}
330+
return await uploadRecordedMedia(videoPath, remotePath, {
331+
user,
332+
pass,
333+
method,
334+
headers,
335+
fileFieldName,
336+
formFields,
337+
});
338+
} finally {
339+
await fs.rimraf(videoPath);
327340
}
328-
return await uploadRecordedMedia(videoPath, remotePath, {
329-
user,
330-
pass,
331-
method,
332-
headers,
333-
fileFieldName,
334-
formFields,
335-
});
336341
}
337342

338343
/**

0 commit comments

Comments
 (0)