Repository: microsoft/playwright
File: packages/playwright/src/cli/client/program.ts (TypeScript)

Code before:
      return;
    }
    case 'close-all': {
      const entries = registry.entries(clientInfo);
      for (const entry of entries)
        await new Session(clientInfo, entry.config).stop(true);
      return;
    }
    case 'delete-data': {
      const entry = registry.entry(clientInfo, sessionName);
      if (!entry) {
        console.log(`No user data found for browser '${sessionName}'.`);
        return;
      }
      await new Session(clientInfo, entry.config).deleteData();
      return;
    }
    case 'kill-all': {
      await killAllDaemons();
      return;
    }
    case 'open': {
      const entry = registry.entry(clientInfo, sessionName);
      if (entry)
        await new Session(clientInfo, entry.config).stop(true);
      const session = new Session(clientInfo, sessionConfigFromArgs(clientInfo, sessionName, args));
      // Stale session.
      if (await session.canConnect())
        await session.stop(true);

      for (const globalOption of globalOptions)
        delete args[globalOption];
      const result = await session.run(args);
      console.log(result.text);
      return;
    }

    case 'close':
      const closeEntry = registry.entry(clientInfo, sessionName);
      const session = closeEntry ? new Session(clientInfo, closeEntry.config) : undefined;
      if (!session || !await session.canConnect()) {
        console.log(`Browser '${sessionName}' is not open.`);
        return;
      }
      await session.stop();
      return;
    case 'install':
      await install(args);
      return;
    case 'install-browser':
      await installBrowser();

Review comment (suggestion):
I guess this is the place where we set the new version upon reopening. Perhaps we should set the `timestamp` here as well.

Code after:
      return;
    }
    case 'close-all': {
      const entries = registry.entries(clientInfo);
      for (const entry of entries)
        await new Session(entry).stop(true);
      return;
    }
    case 'delete-data': {
      const entry = registry.entry(clientInfo, sessionName);
      if (!entry) {
        console.log(`No user data found for browser '${sessionName}'.`);
        return;
      }
      await new Session(entry).deleteData();
      return;
    }
    case 'kill-all': {
      await killAllDaemons();
      return;
    }
    case 'open': {
      const entry = registry.entry(clientInfo, sessionName);
      if (entry)
        await new Session(entry).stop(true);
      const config = sessionConfigFromArgs(clientInfo, sessionName, args);
      const sessionFile: SessionFile = {
        daemonDir: clientInfo.daemonProfilesDir,
        file: path.join(clientInfo.daemonProfilesDir, `${sessionName}.session`),
        config,
      };
      const session = new Session(sessionFile);
      // Stale session.
      if (await session.canConnect())
        await session.stop(true);

      for (const globalOption of globalOptions)
        delete args[globalOption];
      const result = await session.run(clientInfo, args);
      console.log(result.text);
      return;
    }

    case 'close':
      const closeEntry = registry.entry(clientInfo, sessionName);
      const session = closeEntry ? new Session(closeEntry) : undefined;
      if (!session || !await session.canConnect()) {
        console.log(`Browser '${sessionName}' is not open.`);
        return;
      }
      await session.stop();