codepet 1.0.2 → 1.0.3
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/codepet.js +3 -2
- package/package.json +1 -1
package/bin/codepet.js
CHANGED
|
@@ -350,9 +350,10 @@ function doCard() {
|
|
|
350
350
|
if (fs.existsSync(cardScript)) {
|
|
351
351
|
try {
|
|
352
352
|
execSync(`${PYTHON} "${cardScript}"`, { encoding: 'utf-8', stdio: 'inherit' });
|
|
353
|
-
//
|
|
353
|
+
// 跨平台打开图片
|
|
354
354
|
const cardPath = path.join(os.homedir(), '.codepet', 'card.png');
|
|
355
|
-
|
|
355
|
+
const openCmd = process.platform === 'win32' ? 'start ""' : process.platform === 'darwin' ? 'open' : 'xdg-open';
|
|
356
|
+
execSync(`${openCmd} "${cardPath}"`, { stdio: 'ignore', shell: true });
|
|
356
357
|
} catch (e) {
|
|
357
358
|
console.log(' 卡片生成失败。');
|
|
358
359
|
}
|