mirror of
https://github.com/tiennm99/ccs.git
synced 2026-08-09 00:24:34 +00:00
fix: address PR #373 review feedback
- postuninstall.js: add file logging for debugging on error - profile-hook-injector.ts: use 'wx' flag for atomic marker creation - profile-hook-injector.ts: include parse error message in debug log - install-command.ts: use actual counts for consistent semantics - Windows tests: align Section 7 with per-profile hook architecture
This commit is contained in:
@@ -63,8 +63,8 @@ function migrateGlobalHook(): void {
|
||||
if (!fs.existsSync(ccsDir)) {
|
||||
fs.mkdirSync(ccsDir, { recursive: true, mode: 0o700 });
|
||||
}
|
||||
// Create marker file
|
||||
fs.writeFileSync(markerPath, new Date().toISOString(), 'utf8');
|
||||
// Create marker file atomically (wx = fail if exists, prevents race condition)
|
||||
fs.writeFileSync(markerPath, new Date().toISOString(), { encoding: 'utf8', flag: 'wx' });
|
||||
} catch (error) {
|
||||
if (process.env.CCS_DEBUG) {
|
||||
console.error(warn(`Migration failed: ${(error as Error).message}`));
|
||||
@@ -114,9 +114,11 @@ export function ensureProfileHooks(profileName: string): boolean {
|
||||
try {
|
||||
const content = fs.readFileSync(settingsPath, 'utf8');
|
||||
settings = JSON.parse(content);
|
||||
} catch {
|
||||
} catch (parseError) {
|
||||
if (process.env.CCS_DEBUG) {
|
||||
console.error(warn(`Malformed ${profileName}.settings.json - creating fresh hooks`));
|
||||
console.error(
|
||||
warn(`Malformed ${profileName}.settings.json: ${(parseError as Error).message}`)
|
||||
);
|
||||
}
|
||||
// Continue with empty settings, will add hooks
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user