dashcam 1.3.2-beta → 1.3.3-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/dashcam.js +15 -2
- package/lib/permissions.js +9 -1
- package/package.json +1 -1
package/bin/dashcam.js
CHANGED
|
@@ -101,7 +101,13 @@ async function recordingAction(options, command) {
|
|
|
101
101
|
|
|
102
102
|
// Check screen recording permissions (macOS only)
|
|
103
103
|
const { ensurePermissions } = await import('../lib/permissions.js');
|
|
104
|
-
const hasPermissions = await
|
|
104
|
+
const hasPermissions = await Promise.race([
|
|
105
|
+
ensurePermissions(),
|
|
106
|
+
new Promise((resolve) => setTimeout(() => {
|
|
107
|
+
logger.warn('Permission check timed out, assuming permissions granted');
|
|
108
|
+
resolve(true);
|
|
109
|
+
}, 2000))
|
|
110
|
+
]);
|
|
105
111
|
if (!hasPermissions) {
|
|
106
112
|
log('\n⚠️ Cannot start recording without screen recording permission.');
|
|
107
113
|
process.exit(1);
|
|
@@ -111,7 +117,8 @@ async function recordingAction(options, command) {
|
|
|
111
117
|
log('Starting recording in background...');
|
|
112
118
|
|
|
113
119
|
try {
|
|
114
|
-
|
|
120
|
+
// Add timeout to prevent hanging
|
|
121
|
+
const startRecordingPromise = processManager.startRecording({
|
|
115
122
|
fps: parseInt(options.fps) || 30,
|
|
116
123
|
audio: options.audio,
|
|
117
124
|
output: options.output,
|
|
@@ -119,6 +126,12 @@ async function recordingAction(options, command) {
|
|
|
119
126
|
description: options.description,
|
|
120
127
|
project: options.project || options.k // Support both -p and -k for project
|
|
121
128
|
});
|
|
129
|
+
|
|
130
|
+
const timeoutPromise = new Promise((_, reject) =>
|
|
131
|
+
setTimeout(() => reject(new Error('Recording start timed out after 10 seconds')), 10000)
|
|
132
|
+
);
|
|
133
|
+
|
|
134
|
+
const result = await Promise.race([startRecordingPromise, timeoutPromise]);
|
|
122
135
|
|
|
123
136
|
log(`✅ Recording started successfully (PID: ${result.pid})`);
|
|
124
137
|
log(`Output: ${result.outputPath}`);
|
package/lib/permissions.js
CHANGED
|
@@ -17,7 +17,7 @@ async function checkScreenRecordingPermission() {
|
|
|
17
17
|
// Try to capture a single frame to test permissions
|
|
18
18
|
// This is a quick test that will fail immediately if permissions are denied
|
|
19
19
|
const { stderr } = await execa('screencapture', ['-x', '-t', 'png', '/tmp/dashcam_permission_test.png'], {
|
|
20
|
-
timeout:
|
|
20
|
+
timeout: 1000,
|
|
21
21
|
reject: false
|
|
22
22
|
});
|
|
23
23
|
|
|
@@ -66,6 +66,14 @@ function showPermissionInstructions() {
|
|
|
66
66
|
* Check permissions and show instructions if needed
|
|
67
67
|
*/
|
|
68
68
|
async function ensurePermissions() {
|
|
69
|
+
const platform = os.platform();
|
|
70
|
+
|
|
71
|
+
// Skip permission check entirely on Windows to avoid any potential blocking
|
|
72
|
+
if (platform === 'win32') {
|
|
73
|
+
logger.debug('Windows platform detected, skipping permission check');
|
|
74
|
+
return true;
|
|
75
|
+
}
|
|
76
|
+
|
|
69
77
|
const result = await checkScreenRecordingPermission();
|
|
70
78
|
|
|
71
79
|
if (!result.hasPermission) {
|